p',
	url: 'https://oss.aliyuncs.com',

	filters: {
		mime_types: [ //只允许上传图片和zip文件
			{
				title: "Image files",
				extensions: "jpg,gif,png,bmp"
			},
			// { title : "Zip files", extensions : "zip,rar" }
		],
		max_file_size: '10mb', //最大只能上传10mb的文件
		prevent_duplicates: false //不允许选取重复文件
	},

	init: {
		PostInit: function() {
			//判断是否为android端访问
			function _IsAndroid() {
				if(/(Android|Adr)/i.test(navigator.userAgent)) {
					return true;
				} else {
					return false;
				}
			}
			if(_IsAndroid()) {
				document.getElementsByClassName('moxie-shim')[0].children[0].removeAttribute("capture");
			}
			$('.moxie-shim').css({
				'width': '100%',
				'height': '100%'
			})
		},

		FilesAdded: function(up, files) {
			set_upload_param(uploader, '', false);
			return;
		},

		BeforeUpload: function(up, file) {

			set_upload_param(up, file.name, true);
		},

		FileUploaded: function(up, file, info) {
			if(info.status == 200) {
				// layer.msg('上传中,请稍等...', { time: 2000 });
				$('#demo1').attr('src', 'http://lfcy.oss-cn-beijing.aliyuncs.com/' + get_uploaded_object_name(file.name));
				$('#zcard').attr('value', 'http://lfcy.oss-cn-beijing.aliyuncs.com/' + get_uploaded_object_name(file.name));
				$('#upimg1').hide();
				mui('#photo_menu').popover('hide');
			} else if(info.status == 203) {
				console.log('上传到OSS成功，但是oss访问用户设置的上传回调服务器失败，失败原因是:' + info.response);
			} else {
				console.log(info.response);
			}
		},

		Error: function(up, err) {
			if(err.code == -600) {
				console.log('\n选择的文件太大了,可以根据应用情况，在upload.js 设置一下上传的最大大小');
			} else if(err.code == -601) {
				console.log('\n选择的文件后缀不对,可以根据应用情况，在upload.js进行设置可允许的上传文件类型')
			} else if(err.code == -602) {
				console.log('\n这个文件已经上传过一遍了');
			} else {
				console.log("\nError xml:" + err.response);
			}
		}
	}
});

uploader.init();